#!/usr/bin/python
# -*- coding: UTF8 -*-

from django.db import models

# Create your models here.
#正版网站
class Publisher(models.Model):
    name = models.CharField(max_length=30, db_index=True)
    homepage = models.URLField() #主页
    update_page = models.URLField() #列表页面
    update_pattern=models.CharField(max_length=100)
    novel_page = models.URLField() #图书页面
    author_page = models.URLField() #作者页面
    content_page = models.URLField() #章节页面
    last_update = models.CharField(max_length=50)
    actived = models.BooleanField()
    
#作者
class Author(models.Model):
    name = models.CharField(max_length=30, db_index=True)
    
#小说信息
class Novel(models.Model):
    name = models.CharField(max_length=100, db_index=True)
    alias_name = models.CharField(max_length=100, db_index=True)
    author = models.ForeignKey(Author)

class NovelPage(models.Model):
    novel=models.ForeignKey(Novel)
    publisher = models.ForeignKey(Publisher)
    novel_code = models.CharField(max_length=20)
    novel_page = models.URLField() #图书页面

#章节信息
class ContentPage(models.Model):
    title=models.CharField(max_length=50, db_index=True)
    novel=models.ForeignKey(Novel, db_index=True)
    publisher = models.ForeignKey(Publisher)
    novelpage=models.ForeignKey(NovelPage)
    novel_code = models.CharField(max_length=20)
    content_code = models.CharField(max_length=20)
    content_page = models.URLField() #图书页面
    update_time=models.DateTimeField(db_index=True)

